import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const router = new VueRouter({
  mode: 'hash',

  routes: [
    {
      path: '/',
      name: 'hello',
      component: () => import(/* webpackChunkName: "components" */ '@components/HelloWorld')
    },
    {
      path: '/a-page',
      name: 'a-page',
      component: () => import(/* webpackChunkName: "components" */ '@components/a')
    },
    {
      path: '/b-page',
      name: 'b-page',
      component: () => import(/* webpackChunkName: "components" */ '@components/b')
    }
  ],

  scrollBehavior (to, from, savedPosition) {
    if (savedPosition) return savedPosition

    return {
      x: 0,
      y: 0
    }
  }
})

export default router
